package main 
import (
    "fmt"
    "encoding/json"
)
type Student struct {
	Id string `json:"id"`
	Name string `json:"name"`
	Age int `json:"age"`
	Gender string `json:"gender"`
	Sno string `json:"sno"`
}

func main() {
	var s = Student{
		Id: "1",
		Name: "tom",
		Age: 18,
		Gender: "male",
		Sno: "2018001",
	}
	b, err := json.Marshal(s)
	if err != nil {
		fmt.Println("json marshal failed, err:", err)
		return
	}
	fmt.Printf("json:%s\n", string(b))

}